//
//  MineCell.m
//  Tunnel
//
//  Created by wbb on 2025/6/2.
//


#import "MineCell.h"

@interface MineCell()
@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView * arrowImageView;
@end

@implementation MineCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        self.backgroundColor = [UIColor clearColor];
        [self initUI];
    }
    return  self;
}
- (void)initUI {
    
    // 创建图片视图
    self.imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
    self.imgView.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.imgView];
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
        make.width.height.offset(12);
    }];
    
    // 创建标题标签
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:14];
    self.titleLabel.textColor = main_text_color;
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.imgView.mas_right).offset(10);
        make.centerY.mas_equalTo(0);
    }];
    
    
    self.arrowImageView = [[UIImageView alloc] init];
    self.arrowImageView.image = [UIImage imageNamed:@"arrow"];
    self.arrowImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.arrowImageView];
    [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
    }];
}

- (void)setCornerForIndexPath:(NSIndexPath *)indexPath totalRows:(NSInteger)totalRows dataSource:(NSArray *)dataArray {
    [super setCornerForIndexPath:indexPath  totalRows:totalRows];

    NSDictionary *dic = dataArray[indexPath.row];

    self.imgView.image = [UIImage imageNamed:dic[@"imgName"]];
    self.titleLabel.text = dic[@"title"];
}
@end

